//
//  actviityTableViewCell.m
//  简单豆瓣不得不交版 1 带
//
//  Created by dllo on 16/6/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "actviityTableViewCell.h"
#import "avtviityModel.h"
#import "UIImageView+WebCache.h"

@implementation actviityTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self doIt];
    }
    return self;
}


- (void)doIt {
    
    self.imageV = [[UIImageView alloc] init];
    self.imageV.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.imageV];
    [_imageV release];

    
    self.imageV1 = [[UIImageView alloc] init];
    self.imageV1.backgroundColor = [UIColor whiteColor];
    self.imageV1.image = [UIImage imageNamed:@"bg_eventlistcell@2x.png"];
    [self.contentView addSubview:self.imageV1];
    [_imageV1 release];
    
    self.imageV2 = [[UIImageView alloc] init];
    self.imageV2.image = [UIImage imageNamed:@"bg_share_large.png"];
    [self.contentView addSubview:self.imageV2];
    [_imageV2 release];

    self.imageV3 = [[UIImageView alloc] init];
    self.imageV3.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.imageV3];
    [_imageV3 release];
    
    
    self.labelOne = [[UILabel alloc] init];
    [self.imageV1 addSubview:self.labelOne];
    [_labelOne release];
    
    self.labelTwo = [[UILabel alloc] init];
    [self.imageV2 addSubview:self.labelTwo];
    self.labelTwo.font = [UIFont systemFontOfSize:13];
    [_labelTwo release];
    
    self.labelThree = [[UILabel alloc] init];
    [self.imageV2 addSubview:self.labelThree];
    self.labelThree.font = [UIFont systemFontOfSize:13];
    [_labelThree release];

    
    self.bigLabel = [[UILabel alloc] init];
    [self.imageV2 addSubview:self.bigLabel];
 //   self.bigLabel.backgroundColor = [UIColor redColor];
    self.bigLabel.font = [UIFont systemFontOfSize:17];
    [_bigLabel release];

    self.imageV111 = [[UIImageView alloc] init];
    self.imageV111.image = [UIImage imageNamed:@"icon_date@2x.png"];
    [self.contentView addSubview:self.imageV111];
    [_imageV111 release];
    
    self.imageV222 = [[UIImageView alloc] init];
    self.imageV222.image = [UIImage imageNamed:@"icon_spot@2x.png"];
    [self.contentView addSubview:self.imageV222];
    [_imageV222 release];

    self.imageV333 = [[UIImageView alloc] init];
    self.imageV333.image = [UIImage imageNamed:@"icon_catalog@2x.png"];
    [self.contentView addSubview:self.imageV333];
    [_imageV333 release];
    
    self.labelFour = [[UILabel alloc] init];
    [self.imageV2 addSubview:self.labelFour];
    self.labelFour.font = [UIFont systemFontOfSize:16];
    [_labelFour release];
    
    self.LeiXingleLabel = [[UILabel alloc] init];
    [self.imageV2 addSubview:self.LeiXingleLabel];
    self.LeiXingleLabel.font = [UIFont systemFontOfSize:16];
    [_LeiXingleLabel release];
    
    
}


- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.imageV1.frame = CGRectMake(15, 10, 384, 180);
    self.imageV2.frame = CGRectMake(16, 45, 382, 140);
    self.imageV3.frame = CGRectMake(300, 52, 95, 126);
    
    self.labelOne.frame = CGRectMake(10, 3, 370, 30);
    self.labelTwo.frame = CGRectMake(20, 110, 100, 20);
    self.labelThree.frame = CGRectMake(130, 110, 100, 20);
   self.bigLabel.frame = CGRectMake(35, 11, 300, 20);
    
    self.imageV111.frame = CGRectMake(16, 55, 24, 24);
    self.imageV222.frame = CGRectMake(16, 90, 24, 24);
    self.imageV333.frame = CGRectMake(16, 125, 24, 24);
    self.labelFour.frame = CGRectMake(32, 47, 240, 20);
    
    self.LeiXingleLabel.frame = CGRectMake(32, 82, 240, 20);
    
    
}


- (void)setModel:(avtviityModel *)model{
    
    if (_model != model) {
        [_model release];
        _model = [model retain];
        
    }
    
    NSURL *url = [NSURL URLWithString:model.image];
    [self.imageV3 sd_setImageWithURL:url];

    self.labelOne.text = model.title;
    self.bigLabel.text = model.begin_time;
    self.labelFour.text = model.address;
    
    self.labelTwo.text = [NSString stringWithFormat: @"感兴趣: %@",model.wisher_count];
     self.labelThree.text = [NSString stringWithFormat: @"参加: %@",model.participant_count];
    self.LeiXingleLabel.text = [NSString stringWithFormat:@"类型: %@",model.category_name];
    
    /* self.labelTwo.text = [model.participant_count stringValue];
     
     self.labelThree.text = [model.participant_count stringValue];
*/
 
}








@end
